// Provides a function for sending messages to the RedSwoosh client.

var ft_messages = [];
function ft_send_message(url, func)
{
    var request = new XMLHttpRequest();
    request.open("GET", url);
    request.setRequestHeader("user-agent", "foxtorrent");

	request.index = ft_messages.length;
    request.onreadystatechange = function(){
		try
		{
			if(request.readyState == 4 && request.status == 200){
					if(func) func(request.responseText);
					ft_messages.splice(request.index, 1);
			}
		}
		catch(e)
		{
			//dumpError("AJAX request failed: " + url);
			//for(x in e) dumpError("Error(" + x + "): " + e[x]);
		}
	}
	
	ft_messages.push[request];
	request.send(null);
}